﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using DocumentManagement.ViewsModels;

namespace DocumentManagement.Views
{
    /// <summary>
    /// Interaction logic for OptionReportUserControl.xaml
    /// </summary>
    public partial class OptionReportUserControl : UserControl
    {
        OptionReportUserControlViewsModel _optionReportUserControlViewsModel;
        public OptionReportUserControl()
        {
            InitializeComponent();
            _optionReportUserControlViewsModel = this.Resources["optionReportUserControlViewsModel"] as OptionReportUserControlViewsModel;
        }

        private void ReportINAllRadioButton_Checked(object sender, RoutedEventArgs e)
        {
            
        }

        private void OKButton_Click(object sender, RoutedEventArgs e)
        {
            if (ReportINAllRadioButton.IsChecked == true)
            {
                ReportDocumentIN showReport = new ReportDocumentIN();
                showReport.ShowDialog();
            }
            if (ReportOutAllRadioButton.IsChecked == true)
            {
                ReportDocumentOut showReport = new ReportDocumentOut();
                showReport.ShowDialog();
            }
            if (ReportInFromDivisionRadioButton.IsChecked == true && FormDivisionIDcomboBox.Text !="")
            {
                //_optionReportUserControlViewsModel.checkDivisionID();
                ReportDocumentINFromDivision showReport = new ReportDocumentINFromDivision(Convert.ToInt32(FormDivisionIDcomboBox.SelectedValue));
                showReport.ShowDialog();
            }

            if (ReportOutToDivisionRadioButton.IsChecked == true && ToDivisionIDcomboBox.Text != "")
            {
                //_optionReportUserControlViewsModel.checkDivisionID();
                ReportDocumentOutToDivision showReport = new ReportDocumentOutToDivision(Convert.ToInt32(ToDivisionIDcomboBox.SelectedValue));
                showReport.ShowDialog();
            }

            if (ReportInDateRadioButton.IsChecked == true && DocumentINDatePicker1.SelectedDate != null && DocumentINDatePicker2.SelectedDate != null)
            {
                //_optionReportUserControlViewsModel.checkDivisionID();
                ReportDocumentINDate showReport = new ReportDocumentINDate(DocumentINDatePicker1.SelectedDate.Value.Date, DocumentINDatePicker2.SelectedDate.Value.Date);
                showReport.ShowDialog();
            }
            if (ReportOutDateRadioButton.IsChecked == true && DocumentOUTDatePicker1.SelectedDate != null && DocumentOUTDatePicker2.SelectedDate != null)
            {
                //_optionReportUserControlViewsModel.checkDivisionID();
                ReportDocumentOutDate showReport = new ReportDocumentOutDate(DocumentOUTDatePicker1.SelectedDate.Value, DocumentOUTDatePicker2.SelectedDate.Value);
                showReport.ShowDialog();
            }


        }

        private void CancelButton_Click(object sender, RoutedEventArgs e)
        {
            ReportINAllRadioButton.IsChecked=false;
            ReportOutAllRadioButton.IsChecked=false;
            ReportInFromDivisionRadioButton.IsChecked=false;
            FormDivisionIDcomboBox.Text = "";
            ReportOutToDivisionRadioButton.IsChecked=false;
            ToDivisionIDcomboBox.Text = "";
            ReportInDateRadioButton.IsChecked=false;
            DocumentINDatePicker1.SelectedDate=null;
            DocumentINDatePicker2.SelectedDate=null;
            ReportOutDateRadioButton.IsChecked=false;
            DocumentOUTDatePicker1.SelectedDate=null;
            DocumentOUTDatePicker2.SelectedDate = null;
        }
    }
}
